Improved readability of code. Fixed image loading problems