fixed bugs, reworked modules to correspond recent changes