Moved auto code to auto method