Made more private functions etc