Implemented first version of smithnormalform