Work in progress (refactored and stuff)