Updated Invert Layer, JS can pass test, some alignment changes, Sec lowered in 24h

I wanted to give back a bit to code that was very useful starting point for me. 
Thank you.