please put this function at the beginning also it makes things clearer