Added helper class, fixed some bugs