bug fixing and clean code