Fixed issues with bugs and made some improvements