Added check-functions. Need to test better and prettify