minor revision to main fn + added small view fn