fixed small bugs and cleanded code a bit
merged