fixed image linking issue and cleaned up some code