refactoring data, mysql stuff