Bug fix/cleanup