Cleaned up partial application code