Fixed problems with directory restructure, updated some minor bugs in the API