[Mantle/remind101] Did some restructuring for cleaner code.