completely rewritten, version pushed to 1.1.0