fixed indentation
basic functionality implemented
working for single case
final cleanup of code