better line parsing, remove comments and more