updated code after basic tests