Working Version of Script with proper output and parsing