optimized functions, added while to validate presence, separated code for read and trim()
separated constants in json and modified regex