cleaned up functions, starting to parse