Completed functionality for SPA demo