implementation of various problems
fixed bug