Merged uncommitted changes. Fixed some bugs!