added the auto keyword in some places and moved the definition of a few methods