Bug fixes and refactoring old code almost mostly done(Testing ongoing)