Cleaned up more and made more helper functions