Some to implement, lots to refactor, lots to comment..