re-orging code