fixed some bugs and automation added