Cleaned up parser logic a bit and added missing doc blocks