Final Tested Code