Major update on code arrangement.May be broken