used arrays to simplify code