fixed some minor bugs, added new functionality