updated to fix minor bugs