Since we'll want to use them elsewhere, we should make these helper functions. It also makes the code look a lot neater. Unfortunately, it adds a bit more indirection, but this isn't a critical flaw here.