Added final code, all re-factored with new time