Re-written scan parsing. Improved makefile. Cleaned code.