Restructure code

Restructure code