Fixes to player damage and cleaned up code