Deleted functions after finding out that similar functionality is present in a module of standard library. DRY. Changed a few things