re-structured a bit