minor fixes.
still works not like it supposed to work.
everything in one file.