Big code change to use framework
Working using framework