Working version

Minus bugs