bug fixing and minor prototyping