fixing implementation troubles and minor errors