Refactored algmoid.h to be templated. Added demo