Fixing drawing issues, refactor to functions