Removed unused functions and made minor fixes