Extremely messy but more or less working.