Added code checking
Added documentation explaning how it works