All done, ready for testing
minor improvements and bug fixies if necessary