Cleaned up original script. Started method for general case.