Code commenting and adding state support

Also added 2 more cron functions on that runs ever half second and one
that runs every 2 seconds this is for function that need more or less
time intervals.