neater code and some stuff with arrays