Modified to work with online