remove legacy code and finish improvements. still untested
Tested and bugs fixed, new features mostly complete to working state