fixed dragging and added centre and resize functions
center function is still quite buggy...