Moved all logic under the same entry point.