Add maestro and lots of bugfixes

(Not enough time to clean whitespace or make smaller, meaningful commits)
Add test programming script