Fixed issues and made it work