modulized a bit with functions