Started integration with main logic

Also made a isNaN simpler boolean (progress!)