EDIT: Refactored all code
FIX: Fix all merge errors