first code, basic function finished