Added Logger. Fixed Bugs