Fixed bugs, deleted unnecessary files, added new functions