Cleaned up input parsing, last few fixes