Adding a bit refactoring

1. Enclosing tuples in brackets.
2. Checking return values from functions.
3. Removing hardcoding from a few places