reorder code for readbility