fixed bugs and made final changes