code refactor, drawing at center rather than corner