rerranging code