working but it requires a few try catches..