Fixed Generics of input to Algorithm
Made more generic. Warning: now has deprecated contructors!