Added missing shapes and some averaging code.