Starting work on main functions