fixed problems causing parsing conflicts
TODO: cleaning code and improved documentation
TODO: more extensive testing