Clean up code, add support for 5 way clustering