Further Edits to main functions