Implemented inverted spikes
made major style and indentation fixes.
fixed major indentation, style issues