corrected bugs, simplified stuff