Cleaned up some code for #17