refactored everything. v1.0