Updated: Separated tasks and added multi threaded opearations for parallel processing.