Fixed issues and tested