refactoring. Added bug logger. Added some extensions
refactoring & documentation