refactored specs and added specs for Mail. Moved files to lib folder