better parsing, closes #3, closes #4