sorting stuff out
added tests