improve code, thanks to Simon Meier
pretify code

* remove redundant functions
* remove deprecated imports