Cleaned up some of the parsing functions