took out template has_many units logic
added template generation logic and moved sidebar logic to be universal