Second commit. Fixed minor bugs