Tests added, code cleaned