resources added and also some code refactoring