Formatted Code as suggested by Vivek