Cleaned up a bit. Sort still broken