made all into methods where possible