Basic datastruct and algorithm implementation.