Cleaned code and some changes